function Person(name, friends) {
  this.name = name;
  this.friends = friends;
}

Person.prototype.eating = function () {
  console.log(this.name + "eating ~~");
};

function Student(name, friends, sno) {
  // 在重新调用一次
  Person.call(this, name, friends);
  this.sno = sno;
}

// 重要代码!!!
Student.prototype = new Person();

Student.prototype.studying = function () {
  console.log(this.name + "studying");
};

var stu = new Student("xjh", ["xjh2"], 11);
var stu2 = new Student("xjh1", ["keb"], 11);
stu.friends.push(1);
console.log(stu2.friends);
console.log(stu.friends);
stu.eating();
